/// @description Insert description here
// You can write your code in this editor
speed = 0;
if  object_exists(o_Hero)&&point_distance(x, y, Main.x , Main.y)>250  {
direction = point_direction( x, y, Main.x , Main.y);// вычислить направление движения врага к герою
speed = spd;
} else if (point_distance(x, y, Main.x , Main.y)<200){speed = -spd/2;}
kd--;
if (instance_exists(o_Hero)){
var enem = instance_nearest(x,y,o_Hero);
if (kd<= 0 && instance_exists(o_Hero)){
	
		if (point_distance(x, y, enem.x , enem.y )<400){
			with (instance_create_layer(x,y,"bullets",o_blackbullet)){
	direction = point_direction(x, y, enem.x , enem.y );
	speed = 10;
	};kd = 2*fullKd*4;
		}
	}}









